 <div class="container">
        <div class="row">
            <div class="col-md-8 col-md-offset-2">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3>Post ad</h3>
                    </div>
                    <div class="panel-body">
                    <?php foreach($records as $row) { ?>
                        <form action="  <?php echo site_url('members/update_ad'); ?>" method="post"  enctype="multipart/form-data">
                            <div>
                                <label>
                                Ad Title:
                                <input name="title" value="<?php echo $row->ad_title; ?>" class="form-control" type="text">
                                </label><br>
                                
                                <label>
                                Category:
                                    <select name="cat" class="form-control">
                                        <option  <?php if($row->cat_id==1){echo "selected='selected'";}  ?> >1</option>
                                        <option  <?php if($row->cat_id==2){echo "selected='selected'";}  ?> >2</option>
                                    </select>
                                </label><br>
                                
                                <label>
                                Price:
                                <input name="price"  value="<?php echo $row->price; ?>"  class="form-control" type="text">
                                </label><br>
                                
                                <label>
                                Discription:
                                <textarea name="disc" style="width:180%; height:30%;" class="form-control"><?php echo $row->disc; ?></textarea>
                                </label><br>
                                <table>
                                <tr>
                                    <td>
                                        <img src="<?php echo $row->img_1; ?>" style="width:30%">
                                    </td>
                                    <td>
                                        <label>
                                        Image 1:
                                        <input type="file" name="userfile1"  >
                                        </label>
                                    </td>
                                    </tr>
                                    
                                      <tr>
                                    <td>
                                        <img src="<?php echo $row->img_2; ?>" style="width:30%">
                                    </td>
                                    <td>
                                        <label>
                                        Image 2:
                                        <input type="file" name="userfile2" >
                                        </label>
                                    </td>
                                    </tr>
                                    <tr></tr>
                                      <tr>
                                    <td>
                                        <img src="<?php echo $row->img_3; ?>" style="width:30%">
                                    </td>
                                    <td>
                                        <label>
                                        Image 3:
                                        <input type="file"  name="userfile3" >
                                        </label>
                                    </td>
                                    </tr>
                                </table>
                                
                                <br><br>
                                
                                <label>
                                    Keywords:
                                    <textarea name="keywords"  style="width:180%; height:30%;" class="form-control" ><?php echo $row->keywords; ?></textarea>
                                </label><br>
                                
                                <label>
                                    Contact No:
                                    <input name="contact" type="text"  value="<?php echo $row->contact; ?>"  class="form-control">
                                </label><br>
                                
                                <center>
                                    <form action="  <?php echo site_url('members/my_ads'); ?>" >
                                    <input type="submit" value="cancel" class="btn btn-primary">
                                    </form>
                                    <input type="submit" value="update" class="btn btn-primary">
                                </center>
                                <input type="hidden" value="<?php echo $row->ad_id; ?>"  name="ad_id">
                            </form>   
                            <?php } ?>
                                                     
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>